﻿@model ExampleProject.Models.Project

@{
    ViewBag.Title = "Create project";
}

<h2>Create</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>Project</h4>
        <hr />
        @Html.ValidationSummary(true)

        <div class="form-group">
            @Html.LabelFor(model => model.Name, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.Name)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Number, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.Number, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.Number)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Customer, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.Customer, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.Customer)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.StartDate, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.StartDate, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.StartDate)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.EndDate, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.EndDate, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.EndDate)
            </div>
        </div>
        <div class="form-group">
            @Html.CheckBoxFor(m => m.TermsAndConditionsAccepted)
            @Html.LabelFor(m => m.TermsAndConditionsAccepted, new { @class = "checkbox" })
            @Html.ValidationMessageFor(m => m.TermsAndConditionsAccepted)
        </div>
        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Create" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script src="~/Scripts/customValidation.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#StartDate").datepicker({
                dateFormat: "dd/mm/yy",
                changeMonth: true,
                changeYear: true,
                onSelect: function (selected) {
                    $("#EndDate").datepicker("option", "minDate", selected)
                }
            }).attr('readonly', 'readonly');
            $("#EndDate").datepicker({
                dateFormat: "dd/mm/yy",
                changeMonth: true,
                changeYear: true
            });

        });
    </script>
}